package lesson15;

public class Car {
	String model;
	double maxSpeed;
	double currentSpeed;
	String color;
	byte gear;
	Person owner;
	static int count;
	double price;
	boolean isSportCar;
	void changeOwner(Person newOwner)
	{
		this.owner = newOwner;
	}

	double calculateCarPriceForScrap(double metalPrice)
	{
		double coef = 0.2;
		if(this.color.equalsIgnoreCase("black") || this.color.equalsIgnoreCase("white"))
		{
			coef+=0.05;
		}
		if(isSportCar)
			coef+=0.05;
		double price = metalPrice*coef;
		return price;
	}
	boolean isMoreExpensive(Car car)
	{
		if(this.price > car.price)
			return true;
		else
			return false;
	}
	Car(String model, boolean isSportCar,String color)
	{
		this.model = model;
		this.isSportCar = isSportCar;
		this.color = color;
		
	}
	Car(String model, boolean isSportCar, String color, double price, double maxSpeed)
	{
		this(model,isSportCar,color);
		this.price = price;
		if(maxSpeed>200)
		{
			if(this.isSportCar == true)
				this.maxSpeed = maxSpeed;
		}
		else
			this.maxSpeed = maxSpeed;
	}
	
	void accelerate()
	{
		boolean isSportCar = false;
		this.isSportCar = false;
		if(currentSpeed + 10 >= maxSpeed)
		{
			currentSpeed = maxSpeed;
		}
		else 
		{
			currentSpeed+=10;
		}
	}
	void changeGearUp()
	{
		gear++;
	}
	void changeGearDown()
	{
		if(currentSpeed == 1)
		{
			System.out.println("It is down level of gear!");
		}
		else 
		gear--;
	}
	void changeGear(int nextGeear)
	{
		nextGeear = gear;
	}
	void changeColor(String newColor)
	{
		newColor = color;
	}
}
